<script>

import Http from './utils/http.js'
	// 项目的根组件
	export default {
		async onLaunch() {
			if(process.env.NODE_ENV === 'development'){
				//做开发操作配置设置
			    console.log('开发环境')
			}else{
				// 做生产环境配置设置
			    console.log('生产环境')
			}
			
			// 验证token有效期
			let token = uni.getStorageSync('token')
			let uid = uni.getStorageSync('uid')
			
			this.userInfo = {
				token,uid
			}
			
			if( !token ){
				console.log('token没有值，显示未登录')
				uni.setTabBarItem({
					index:2,
					text:'未登录'
				})
			}else{
				//  /api/checktoken
				let result = await Http({
					url:'/api/checktoken',
					header:{
						authorization:token
					}
				})
				console.log( result,'11111' )
				if( result.data.list.code == 200 ){
					uni.setTabBarItem({
						index:2,
						text:'已登录'
					})
				}else{
					uni.setTabBarItem({
						index:2,
						text:'未登录'
					})
				}
			}
			
			
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
